home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / bash-1.12 / dist / examples / alias-conv.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1991-07-07  |  742 b   |  23 lines

  1. #! /bin/sh
  2. #
  3. # Convert Csh aliases to Bash aliases.  Adapted from a similar program
  4. # supplied with zsh.
  5. #
  6. # This is a quick script to convert csh aliases to bash aliases/functions.
  7. # Pipe the output of csh's alias command through this; it will generate
  8. # a series of alias/function definitions on stdout, suitable for
  9. # processing by bash.
  10. #
  11. # This is not perfect, but it gets most common aliases; it should manage to
  12. # cut down a lot of the busy work.
  13. #
  14. sed -e 's/    (\(.*\))/    \1/' >/tmp/cz$$.1
  15. grep ! /tmp/cz$$.1 >/tmp/cz$$.2
  16. grep -v ! /tmp/cz$$.1 >/tmp/cz$$.3
  17. sed -e "s/'/'"\\\\"''"/g -e 's/^\([^    ]*\)    \(.*\)$/alias \1='"'\2'/" \
  18.     /tmp/cz$$.3
  19. sed -e 's/![:#]*/$/g' -e 's/^\([^    ]*\)    \(.*\)$/\1 () { \2 }/' /tmp/cz$$.2
  20. rm /tmp/cz$$.?
  21.  
  22. exit 0
  23.